#ifndef __XML_MESH_H
#define __XML_MESH_H

#include <ostream>
#include <string>
#include <vector>

namespace pugi
{
  class xml_node;
}

namespace dolfin
{

  class Mesh;
  class MeshData;
  class MeshDomains;

  class XMLMesh
  {
  public:

    /// Read mesh from XML
    static void read(Mesh& mesh, const pugi::xml_node mesh_node);

    /// Write mesh to XML
    static void write(const Mesh& mesh, pugi::xml_node mesh_node);

  private:

    // Read mesh
    static void read_mesh(Mesh& mesh,
                          const pugi::xml_node mesh_node);

    // Read mesh data
    static void read_data(MeshData& data,
                          const pugi::xml_node mesh_node);

    // Read mesh domains
    static void read_domains(MeshDomains& domains,
                             const pugi::xml_node mesh_node);

    // Read array
    static void read_array_uint(std::vector<unsigned int>& array,
                                const pugi::xml_node xml_array);

    // Write mesh
    static void write_mesh(const Mesh& mesh,
                           pugi::xml_node mesh_node);

    // Write mesh data
    static void write_data(const MeshData& data,
                           pugi::xml_node mesh_node);

    // Write mesh markers
    static void write_domains(const MeshDomains& domains,
                              pugi::xml_node mesh_node);

  };

}

#endif
